package base.util.lib;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
@SuppressWarnings("all")
public class MapUtils {
	public static void main(String[] args) {
		
		Map map = new HashMap();
		float num=10;
		map.put("num", num);
		map.put("no", new Integer(2));
		map.put("sqlnum", new BigDecimal(56));
		map.put("date",new Date());
		map.put("str","abc");
		map.put("bf",new StringBuffer("BF"));
       List cols=new ArrayList();
       Vector params =new Vector();
		Object[] strs = map.keySet().toArray();
		for (Object key : strs) {
			Object value=map.get(key);
			if (value instanceof java.util.Date) {
				System.out.println("date**********"+value);
			}
			if (value instanceof java.lang.String) {
				System.out.println("String **********"+value);
			}
			if (value instanceof java.lang.StringBuffer) {
				System.out.println("StringBuffer **********"+value);
			}
			if (value instanceof java.math.BigDecimal) {
				System.out.println("BigDecimal **********"+value);
			}
			if (value instanceof java.lang.Long) {
				System.out.println("Long **********"+value);
			}
			if (value instanceof java.lang.Double) {
				System.out.println("Double **********"+value);
			}
			if (value instanceof java.lang.Integer) {
				System.out.println("java.lang.Integer **********"+value);
			}
			
			System.out.println(value);
			System.out.println(key);
			cols.add(key);
			params.add(value);
		}
		
		System.out.println(cols);
		System.out.println(params);

	}
	/**
	 * 把Map 对象改变为 列名集合和参数值集合
	 * @param objMap Map  封装参数对象
	 * @param cols  List   列名集合
	 * @param params Vector  参数值集合
	 */
	public static void changerMap(Map objMap,List cols,Vector params) {
			Object[] strs = objMap.keySet().toArray();
			for (Object key : strs) {
				Object value=objMap.get(key);
			    cols.add(key);
			    params.add(value);
			}
	}

}
